﻿@Url =

    GetParameterByName: (name) ->
        name = name.toLowerCase()
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]")
        regexS = "[\\?&]" + name + "=([^&#]*)"
        regex = new RegExp(regexS, "gi")
        results = regex.exec(window.location.href)
        if results is null
            return ''
        else
            return decodeURIComponent(results[1].replace(/\+/g, " "))

    GetParameterByNameOrEmptyString: (name) ->
        result = Url.GetParameterByName(name)
        if result is undefined
            return ''
        else
            return result
    
    GetParameterByNameOrZero: (name) ->
        result = Url.GetParameterByName(name)
        if result is undefined
            return 0
        else
            return result